<div style="widtd : 960px;background: url(JO_images/hr.gif1) repeat-x top left #222;position: relative;float:left;

             ">

  <div  class="bar_720i" style="margin-left: 0px;width :960px" >
    <div style="" class="JO_h1i">
        Thống Kê Tin Nhắn
      
    </div>

      <div class="mar8i"></div>
      <div style="width : 924px;float: left;margin-bottom: 8px;"> 
      <div>
      
<?php
if(!isset($_SESSION[ "JO_account_id" 			])){
	echo ("login");
}else{
$patd ="C:/xampp/htdocs/00_JO/JOi/";
 include ($patd .'controller/JO_sms_Controller.php'); 
$loai=isset($_GET['SO_Loai'])?($_GET['SO_Loai']):"";
$CC=isset($_GET['SO_CC'])?($_GET['SO_CC']):"";
$kieu=isset($_GET['SO_kieu'])?($_GET['SO_kieu']):"";


 /*$today=getdate();
 echo "<pre>";
 print_r($today);
 echo $today['year']."-".$today['mon']."-".$today['mday'];
 echo "</pre>";
 exit;*/
     ?>
      <link rel="stylesheet"		type="text/css"		href="JO_jquery/themes/ui-darkness/jquery-ui-1.8.16.custom.css"/>


      <script type="text/javascript" src="JO_jquery/ui/jquery-ui-1.8.9.custom.js"></script>
     
<script >
    
	function searchKeyPress(e)
    {
	
		
        // look for window.event in case event isn't passed in
        if (window.event) { e = window.event; }
        if (e.keyCode == 13)
        {
			
            tuyen_du_lieu('');
            	

        }
    }
function sendtype(p,c){
	
           if(p!='' && c!='')
			location=("../JOi/index.php?JO_unit=014_SMS_static&SO_Loai="+p+"&SO_CC="+c);
			if(p!='' && c=='')
			location=("../JOi/index.php?JO_unit=014_SMS_static&SO_Loai="+p);
    }
function tuyen_du_lieu(p){
	
	$('#loadcontent').html("<div style=\"height: 45px;text-align: center;width:100%;background: url(JO_ICON/ajax-loader2.gif) center no-repeat\"></div>");
	var loai= $('#choice').val();
	if(loai!='' ){
		if(loai=='day')
		{
			if(sea!='' && sea2!='')
			{
				
				var sea= $('#txtfd').val();
				var sea2=$('#txttd').val();
				var sea3=$('#slpro').val();
				if(sea3!=''){
				if(p!='')
				var url="JO_14_01_ajax_SMS.php?SO_loai="+loai+"&SO_sea="+sea+"&SO_sea2="+sea2+"&Page="+p+"&SO_sea3="+sea3;
				else
				var url="JO_14_01_ajax_SMS.php?SO_loai="+loai+"&SO_sea="+sea+"&SO_sea2="+sea2+"&SO_sea3="+sea3;}
				else
				{
				$('#loadcontent').html('');
				alert('Phải chọn nhà cung cấp')
				}
			}
			else
			{
				
				$('#loadcontent').html('');
				alert('xin nhập đầy đủ thời gian cần xem')
			}
		}
		else
		{
			
			var sea= $('#txtsearch').val();
			var sea2=$('#slpro').val();
			if(sea2!=''){
			if(p!='')
			var url="JO_14_01_ajax_SMS.php?SO_loai="+loai+"&SO_sea="+sea+"&Page="+p+"&SO_sea2="+sea2;
			else
			var url="JO_14_01_ajax_SMS.php?SO_loai="+loai+"&SO_sea="+sea+"&SO_sea2="+sea2;}
			else
			{
				$('#loadcontent').html('');
				alert('Phải chọn nhà cung cấp')
			}
		}
			$('#loadcontent').load(url);
	}
	else
	{
			$('#loadcontent').html('');
			alert('xin mời chọn kiểu xem cần xem')
	}
}
function show()
{
	$('#loadTK').html("<div style=\"height: 45px;text-align: center;width:100%;background: url(JO_ICON/ajax-loader2.gif) center no-repeat\"></div>");
	var sea= document.getElementById('TKF').value;
	var sea2= document.getElementById('TKT').value;
	var sea3=  document.getElementById('TKS').value;
	var sea4=  document.getElementById('TKCC').value;
	if(sea!='' && sea2!=''){
		if(sea4!=''){
	var url="JO_14_02_ajax_SMS.php?SO_sea="+sea+"&SO_sea2="+sea2+"&SO_sea3="+sea3+"&SO_sea4="+sea4;	
	$('#loadTK').load(url);}
	else
		{
			$('#loadTK').html('');
			alert('Phải chọn nhà cung cấp')
		}
	}
	else
	{
	$('#loadTK').html('');
		alert('xin nhập đầy đủ thời gian cần xem')
	}
}
/*
function kt()
{
	var chon=document.getElementById('choice').value;
	if(chon=='day')
	{
		document.getElementById('day').innerHTML="Xem từ ngày <input type='text' style='background:#333;border:none;color:#FFF' name='txtfd' id='txtfd' readonly=\"readonly\"/> Đến Ngày <input type='text' style='background:#333;border:none;color:#FFF' name='txttd' id='txttd' readonly=\"readonly\"/> <input type='button' onclick=\"tuyen_du_lieu('')\" value='Xem' style='background:#333;border:none;color:#FFF'/>"
		$("#txtfd").datepicker({ dateFormat: 'yy-mm-dd' }); 
		$("#txttd").datepicker({ dateFormat: 'yy-mm-dd' }); 
	}
	else
	{
		document.getElementById('day').innerHTML="Nội Dung Cần Xem   <input type='text' style='background:#333;border:none;color:#FFF' name='txtsearch' id='txtsearch' onkeypress=\"searchKeyPress(event);\"/> <input type='button' onclick=\"tuyen_du_lieu('')\" value='Xem' style='background:#333;border:none;color:#FFF'/>"
	}
}*/
function kt()
{
	var chon=$('#choice').val();
	if(chon=='day')
	{
		//$('#td005').html($('#td003').html());
		$('#td001').html('Từ Ngày:');
		$('#td002').html("<input type='text' class='input_texti' name='txtfd' id='txtfd' readonly=\"readonly\"/>");
		$('#td003').html('Đến Ngày:');
		$('#td004').html("<input type='text' class='input_texti' name='txttd' id='txttd' readonly=\"readonly\"/>");
		$('#td005').html("nhà cung cấp : ");
		$('#td006').html(" <select id=\"slpro\" name='slpro'  class=\"input_selecti\"><option style=\"background:#333;border:none;color:#FFF\" value=\"\">--tất cả--</option><option style=\"background:#333;border:none;color:#FFF\">VDC</option><option style=\"background:#333;border:none;color:#FFF\">INCOM</option></select>");
		$('#td007').html('<input type="button" onclick="tuyen_du_lieu(\'\')" value="Xem" class="input_buttoni" style="float: left;"/>');
		$("#txtfd").datepicker({ dateFormat: 'yy-mm-dd' }); 
		$("#txttd").datepicker({ dateFormat: 'yy-mm-dd' }); 
		$("#txtfd").width(80);
		$("#txttd").width(80);
		$("#slpro").width(80);
	}
	else
	{
		
		$('#td001').html('Nội Dung Cần Xem:');
		$('#td002').html("<input type='text' class='input_texti' name='txtsearch' id='txtsearch' />");
		$('#td003').html("Nhà Cung Cấp :");
		$('#td004').html("  <select id=\"slpro\" name='slpro' class=\"input_selecti\"><option style=\"background:#333;border:none;color:#FFF\" value=\"\">--tất cả--</option><option style=\"background:#333;border:none;color:#FFF\">VDC</option><option style=\"background:#333;border:none;color:#FFF\">INCOM</option></select>");
		$('#td005').html('<input type="button" onclick="tuyen_du_lieu(\'\')" value="Xem" class="input_buttoni" style="float: left;"/>');
		$('#td006').html('');$('#td007').html('');
		$("#txtfd").datepicker({ dateFormat: 'yy-mm-dd' }); 
		$("#txttd").datepicker({ dateFormat: 'yy-mm-dd' }); 
	}
}
	</script>


      </div>
        <!--tong hop-->
        <style>
        .JO_middle td{
			vertical-align:middle;
			}
        </style>
        <table class="tbi JO_middle" style="width:944px;">
        	<tr style="vertical-align:middle">
            	<th>
                <select id="TK" onchange="sendtype(this.value,'')" class="input_selecti" style="width:154px">
                  <option style="background:#333;border:none;color:#FFF" value="">--Chọn kiểu Thống Kê--</option>
                  <option style="background:#333;border:none;color:#FFF" value="TH"  <?=($loai=="TH")?"selected='selected'":""?> >Thống Kê Tổng Hợp</option>
                  <option style="background:#333;border:none;color:#FFF" value="CT" <?=($loai=="CT")?"selected='selected'":""?>>Thống Kê Chi Tiết
                  </option>
                </select>
                </th>
        <?php if(isset($_GET['SO_Loai']) && $_GET['SO_Loai']!='')
					$loai=$_GET['SO_Loai'];
				else
					$loai='TH';
					
	  			if($loai=='TH'){
	   			?>
                <th>
           		 Từ Ngày
                 </th>
                 <th>
                  <input type="text" id="TKF" name="TKF" readonly="readonly" class="input_texti"/> 
                  </th>
                  <th>
                 Đến Ngày 
                 </th>
                 <th><input type="text" id="TKT" name="TKT" readonly="readonly" class="input_texti"/> 
                 </th>
                 <th>
               	 Nhà Cung Cấp :
                 </th>
                 <th>
                 <select id="TKCC" name="TKCC"  onchange="sendtype('TH',this.value)" class="input_selecti" >
                 <option style="background:#333;border:none;color:#FFF" value="">
                 	tất cả
                 </option>
                 <option style="background:#333;border:none;color:#FFF" <?=($CC=="VDC")?"selected='selected'":""?>>
                 	VDC
                 </option>
                 <option style="background:#333;border:none;color:#FFF" <?=($CC=="INCOM")?"selected='selected'":""?>>
                 	INCOM
                 </option>
                 </select> 	
                 </th>
                 <?
                 if(isset($_GET['SO_CC'])){
				 ?>
                 <th>
                 Đầu Số :
                 </th>
                 <th>
                 <select id="TKS" name="TKS" class="input_selecti">
                 <option style="background:#333;border:none;color:#FFF" value="">
                 	tất cả
                 </option>
                 
                 <option style="background:#333;border:none;color:#FFF">
                 	<?php
					
						if($_GET['SO_CC']=='VDC'){
							echo "8588";}
							else{
							echo '6089';}
					?>
                 </option>
                 <option style="background:#333;border:none;color:#FFF">
                 	<?php
					if(isset($_GET['SO_CC']))
						if($_GET['SO_CC']=='VDC'){
							echo "8388";}
							else{
							echo '6289';}
					?>
                 </option>
                 <?php
					if(isset($_GET['SO_CC']))
						if($_GET['SO_CC']=='INCOM')
							echo "<option style='background:#333;border:none;color:#FFF'>6389</option>";
							
				 ?>
                 </select> 	
                 </th>
                 <?
                 
				 }
				 ?>
                 <th>
                
                 </th>
                 <tr>
                 <td colspan="7" > <input type="button" onclick="show();" value="Xem" class="input_buttoni" style="margin-left:50%"/></td>
                 </tr>
        <?php
			}else{
		?>
        
        
        
	            <th>
        <select class="input_selecti" onchange="kt()" name="choice" id="choice" style="float: left;">
          <option style="background:#333;border:none;color:#FFF" value="" >--Chọn kiểu Xem--</option>
          <option style="background:#333;border:none;color:#FFF"  <?=($kieu=="id")?"selected='selected'":""?> value="id" >Xem Theo Mã</option>
          <option style="background:#333;border:none;color:#FFF"  <?=($kieu=="day")?"selected='selected'":""?> value="day">Xem Theo Ngày</option>
          <option style="background:#333;border:none;color:#FFF"  <?=($kieu=="tel")?"selected='selected'":""?> value="tel">Xem Theo Nhà Mạng</option>
          <option style="background:#333;border:none;color:#FFF"  <?=($kieu=="num")?"selected='selected'":""?> value="num">Xem Theo Đầu Số</option>
        </select>
                </th>
               <th>
                
           
                </th>
                <th id="td001">Nội Dung Cần Xem </th>
                <th id="td002" ><input type="text" onkeypress="searchKeyPress(event);" class="input_texti" name="txtsearch" id="txtsearch" style="float: left;"/></th>
                <th id="td003"> 	 Nhà Cung Cấp 
                </th>
                <th id="td004">
                 <select id="slpro" name="slpro"   class="input_selecti" >
                 <option style="background:#333;border:none;color:#FFF" value="">
                 	tất cả
                 </option>
                 <option style="background:#333;border:none;color:#FFF" <?=($CC=="VDC")?"selected='selected'":""?>>
                 	VDC
                 </option>
                 <option style="background:#333;border:none;color:#FFF" <?=($CC=="INCOM")?"selected='selected'":""?>>
                 	INCOM
                 </option>
                 </select> 	</th>
                <th id="td005"><input type="button" onclick="tuyen_du_lieu('')" value="Xem" class="input_buttoni" style="float: left;"/></th>
                <th id="td006"></th>
                <th  id="td007"></th>
            
            </tr>
			<?php } ?>
        </table>
        
        <span id="loadTK">
                 
                 </span>
        


        <!-- chi tiet-->
      <span id="loadcontent">
       <div style="height:50px;text-align:center;margin-top:20px;font-size:15px">
     
      </div>
      </span>
        
        
      
<script>
	$(document).ready(function() { 
        $("#TKF").datepicker({ dateFormat: 'yy-mm-dd' }); 
    }); 
	$(document).ready(function() { 
        $("#TKT").datepicker({ dateFormat: 'yy-mm-dd' }); 
    }); 
</script>
<?
}
?>
</div>
    </div>
  
</div>
<script>
setwidth();
function setwidth(){
	$("#slpro").width(80);
}
</script>